<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/head :: head(link)"/>
<body>
<div id="app" class="ok-body" v-cloak>
    <!--模糊搜索区域-->
    <template>
        <div style="margin-bottom: 8px;margin-top: 8px;">
            <i-select @on-change="listParkManage" placeholder="请选择合作单位" v-model="entity.orgId" style="width:200px">
                <i-option v-for="item in orgList" :value="item.orgId" :key="item.orgId">{{ item.name }}</i-option>
            </i-select>
            <i-select placeholder="请选择停车场" v-model="entity.parkManageId" style="width:200px">
                <i-option   v-for="item in parkManageList" :value="item.id" :key="item.id">{{ item.name }}</i-option>
            </i-select>
            <i-input placeholder="输入内容"  v-model="entity.description"  style="width: 200px"></i-input>
            <i-button type="primary"  icon="ios-search" @click="load()">搜索</i-button>
            <i-button type="primary"  icon="ios-redo" @click="reload()" >重置</i-button>
            <i-button type="primary"  icon="md-cloud-download" @click="exportData()" >导出数据</i-button>
        </div>
    </template>
    <template>
        <i-table size="small" :columns="tableTitle"  :data="tableData">
            <template slot-scope="tableScope" slot="action">

            </template>
        </i-table>
        <br>
        <Page  style="float: right;" :current="entity.pageNo" :total="tableSize" :page-size="entity.pageSize"  @on-change="changePage" @on-page-size-change="changePageSize" show-elevator show-sizer show-total></Page>
    </template>
    <form id="exportForm" style="display: none;" method="post">
        <input name="orgId" v-model="entity.orgId" >
        <input name="parkManageId" v-model="entity.parkManageId" >
    </form>
</div>
<div th:replace="common/foot :: foot(script)"></div>
<script th:inline="none">
layui.use(["okUtils", "okLayer"], function () {
    var okUtils = layui.okUtils;
    var okLayer = layui.okLayer;
    var $ = layui.jquery;
    var vm = new Vue({
        el: '#app',
        data: function(){
        var that = this;
		return {
            tableTitle : [{
                title: '序号',
                width : 80,
                render: function(h, params) {
                    return h('span', params.index + (that.entity.pageNo- 1) * that.entity.pageSize + 1);
                }
            },{
                key : "orderNo",
                title : "订单号",
                minWidth:200
            },{
                key : "totalFee",
                title : "付款金额",
                minWidth:150
            },{
                key : "plateNumber",
                title : "车牌号",
                width:150
            },{
                key : "type",
                title : "支付类型",
                width : 150,
                render: function(h, params) {
                    var t = '';
                    switch (params.row.type) {
                        case 0:
                            t = '微信';
                            break;
                        case 1:
                            t = '支付宝';
                            break;
                        case 2:
                            t = 'APPLE PAY';
                            break;
                        case 3:
                            t = 'HUAWEI PAY';
                            break;
                        default:
                            t = '其他';
                            break;
                    }
                    return h('span', t);
                }
            },{
                key : "gmtCreate",
                title : "创建时间",
                minWidth:150
            },{
                key : "validityTime",
                title : "有效期至",
                minWidth:150
            },{
                key : "remark",
                title : "备注",
                minWidth:150
            }],
            tableData : [],
            entity : {
                pageSize : 10,
                pageNo : 1,
                description:'',
                orgId:null
            },
            tableSize : 50,
            orgList:[],
            parkManageList:[]
          }
        },
        methods: {
            load : function() {
                var that = this;
                okUtils.ajaxCloud({
                    url:"/finance/order/list",
                    param : that.entity,
                    success : function(result) {
                         that.tableData = result.msg.pageData;
                         that.tableSize = result.msg.totalCount;
                    }
                });
            },
            listOrg : function() {
                var that = this;
                okUtils.ajaxCloud({
                    url:"/sys/org/select",
                    success : function(result) {
                         that.orgList = result.msg;
                    }
                });
            },
            listParkManage : function() {
                var that = this;
                okUtils.ajaxCloud({
                    url:"/car/parkManage/select",
                    param : {'orgId':vm.entity.orgId},
                    success : function(result) {
                         that.parkManageList = result.msg;
                    }
                });
            },
            reload : function(){
                vm.entity.pageSize = 10;
                vm.entity.pageNo = 1;
                vm.entity.description = '';
                vm.entity.orgId = null;
                vm.entity.parkManageId = null;
                this.load();
            },
            changePage : function(pageNo) {
                vm.entity.pageNo = pageNo;
                vm.load();
            },
            changePageSize : function(pageSize) {
                vm.entity.pageSize = pageSize;
                vm.load();
            },exportData: function () {
                $("#exportForm").attr("action", "/finance/order/export");
                $("#exportForm").submit();
            }
        },
        created: function() {
            this.load()
            this.listOrg();
        }
    })
  });
</script>
</body>
</html>
